home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8590 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.sunquest.com!kitk!kitk
  2. From: kitk@mudshark.sunquest.com (Kit Kauffmann)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to prototype a class?
  5. Date: Thu, 15 Feb 1996 15:56:58
  6. Organization: Sunquest
  7. Message-ID: <kitk.2095.000FF385@mudshark.sunquest.com>
  8. References: <4fvjhe$c6o@nuntius.u-net.net> <DMtxzu.8HK@tr.unisys.com>
  9. NNTP-Posting-Host: kkauffma.sunquest.com
  10. X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
  11.  
  12. In article <DMtxzu.8HK@tr.unisys.com> "Benjamin M. Romer" <bmr1@trpo4.tr.unisys.com> writes:
  13.  
  14. >Use a forward declaration:
  15.  
  16. >class A;      //I promise to define A later.
  17.  
  18. >class B
  19. >{
  20. >  ...
  21. >private:
  22. >     A dataMember;
  23. >};
  24.  
  25. >Class A
  26. >{
  27. >  ...
  28. >private:
  29. >    B dataMember;
  30. >};
  31.  
  32. >Hope this helps.
  33.  
  34. >Benjamin M. Romer
  35. >Software Engineer
  36. >Unisys Corporation
  37.  
  38. >#include <stddisclaim.h>
  39.  
  40. This won't work: the compiler has to know the size of an attribute, which 
  41. doesn't happen w/ a forward declare.  You can declare pointers to objects of 
  42. unknown size, but not objects themselves.
  43.  
  44.  
  45. Kit Kauffmann - kitk@mudshark.sunquest.com
  46. AKA 73363,447 (Compu$erve)
  47.  
  48. Finger me for my public key
  49.